﻿<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>列表</title>
    <link href="http://g.alicdn.com/sj/dpl/1.5.1/css/sui.min.css" rel="stylesheet" />
    <link href="http://g.alicdn.com/sj/dpl/1.5.1/css/sui-append.css" rel="stylesheet" />
    <style type="text/css">
        .ms-controller{visibility:hidden;}
    </style>

</head>
<body ms-controller="listview" class="ms-controller">
    <div class="sui-container" style="width:98%">

        <div ms-include-src="../list/{{FunCode}}.html?rdm={{rdm}}" data-include-rendered='render' style="padding-bottom:20px;">

        </div>
 

        <div id="pageDiv"></div>
        <div class="sui-form form-inline" style="margin-top:20px;">
            <div class="sui-msg msg-large msg-success">
                <div class="msg-con">总数据：{{total}}</div>
                <s class="msg-icon"></s>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="http://g.alicdn.com/sj/lib/jquery/dist/jquery.min.js"></script>
    <script type="text/javascript" src="http://g.alicdn.com/sj/dpl/1.5.1/js/sui.min.js"></script>
    <script src="https://cdn.bootcss.com/avalon.js/1.5.9/avalon.js"></script>
    <script src="/admin/js/ComFunJS.js?v=20180101"></script>
    <script type="text/javascript">
        var model = avalon.define({
            $id: "listview",
            searchkey: "",
            page: { pageindex: 1, pagesize: 10 },
            total: 0,
            FunCode: ComFunJS.getQueryString("funcode"),
            rdm: Math.random(),
            InfoType: ComFunJS.getQueryString("infotype", ""),
            ID: ComFunJS.getQueryString("id", ""),
            ListData:[],
            render: function () {
                if (tempmodel) {
                    tempmodel.Init(model.ID);
                }
            },
            ADD: function (el) {
                if (el) {
                    top.ComFunJS.winShowForm("/admin/base/add.html?funcode=" + model.FunCode + "&ID=" + el.ID , "修改");
                } else {
                    top.ComFunJS.winShowForm("/admin/base/add.html?funcode=" + model.FunCode, "添加");
                }
            },
            SetShelf: function (el) {
                $.getJSON("/adapi/" + model.FunCode + "/shelf/" + el.ID, function (r) {
                    if (r.error == "") {
                        el.IsShelf = el.IsShelf == 1 ? 0 : 1;
                    }
                })
            },
            SetToTop: function (el) {
                $.getJSON("/adapi/" + model.FunCode + "/totop/" + el.ID, function (r) {
                    if (r.error == "") {
                        el.ToTop = el.ToTop == 1 ? 0 : 1;
                    }
                })
            },
            DEL: function (el) {
                if (el) {
                    top.ComFunJS.winShowConfirm("<span style='color:red;'>确定要删除吗?<span>", function () {
                        $.getJSON("/adapi/" + model.FunCode + "/del/" + el.ID, function (r) {
                            if (r.error == "") {
                                top.ComFunJS.winShowMsg("删除成功");
                                model.ListData.remove(el);
                            }
                        })
                    })
                }
            }

        })



    </script>

</body>

</html>


